# encoding=utf-8

# 需要安装 requests     npm install requests
import requests
import time

def D(y):
    print("d")
    time.sleep(1)
    print(y)


def F(timeout=0):
    def A(func):
        print("a")
        def C(x):
            start = time.time()
            print("-----")
            # 超时的
            func(x)
            print("-----")
            print( time.time() - start)
            print(x)
            print("c")
        return C
    return A

@F()
def E(x):
    print("xx") 

@F(timeout=10)
def J(x):
    print("xx") 
# c = A(D)
# c("x")
E("aaaa")

# def A(i: int):
#     print("a")
#     def C():
#         print(i)
#         print("c")
#     return C()
# A(1)

def B():
    print("b")
    return A

# a = B()
# print(a())


# header = {
#     "Accept": "application/json",
#     "Accept-Encoding": "gzip, deflate, br",
#     "Accept-Language": "zh-CN,zh;q=0.9,zh-TW;q=0.8,en-US;q=0.7,en;q=0.6",
#     "Connection": "keep-alive",
#     "Cookie": "_ga=GA1.2.664755153.1585209836; __gads=ID=93616da0167f78c5:T=1585209835:S=ALNI_Mb1qpK9S8EBBFi8IYKlc9XHdYpqRg; UM_distinctid=178986d0e721ee-0166e3bdc05d68-c3f3568-144000-178986d0e73648; __yadk_uid=9rXEPZ6wGMXaUMwSuTXraKHnJM6r1OMP; sensorsdata2015jssdkcross=%7B%22distinct_id%22%3A%2217115de7fad377-01f8e37ab097f8-f313f6d-1327104-17115de7fae922%22%2C%22first_id%22%3A%22%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E8%87%AA%E7%84%B6%E6%90%9C%E7%B4%A2%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC%22%2C%22%24latest_referrer%22%3A%22https%3A%2F%2Fwww.baidu.com%2Flink%22%2C%22%24latest_utm_source%22%3A%22recommendation%22%2C%22%24latest_utm_medium%22%3A%22seo_notes%22%2C%22%24latest_utm_campaign%22%3A%22maleskine%22%2C%22%24latest_utm_content%22%3A%22note%22%7D%2C%22%24device_id%22%3A%2217115de7fad377-01f8e37ab097f8-f313f6d-1327104-17115de7fae922%22%7D; locale=zh-CN; _gid=GA1.2.620644444.1627790001; read_mode=day; default_font=font2; _m7e_session_core=f48cf53d0a212db95480f611f9959b99; CNZZDATA1279807957=463469463-1617461090-https%253A%252F%252Fwww.google.com.hk%252F%7C1627904401; signin_redirect=https://www.jianshu.com/p/80e25cb1d81a; Hm_lvt_0c0e9d9b1e7d617b3e6842e85b9fb068=1627211348,1627790001,1627829418,1627909230; Hm_lpvt_0c0e9d9b1e7d617b3e6842e85b9fb068=1627909230",
#     "Host": "www.jianshu.com",
#     "If-None-Match": 'W/"e39f603a5ebcff23859d200f9c9dc20f"',
#     "Referer": "https://www.jianshu.com/p/80e25cb1d81a",
#     "sec-ch-ua": '"Chromium";v="92", " Not A;Brand";v="99", "Google Chrome";v="92"',
#     "sec-ch-ua-mobile": "?0",
#     "Sec-Fetch-Dest": "empty",
#     "Sec-Fetch-Mode": "cors",
#     "Sec-Fetch-Site": "same-origin",
#     "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36"
# }

# x = header["aaa"]
# print(x)

# r = requests.get(
#     "https://www.jianshu.com/shakespeare/notes/6291468/included_collections?page=1&count=7", headers=header)
# print(r.status_code)

# print(r.text)

# a = []
# len(a)
# import json
# a = "1" + "1"
# print(type(a))
# # print("hello world")

# # x = input("name is:")
# # print("你输入了" + x)
# # 这是注释
# # int:   34  1  2 4  5  7

# # b = 5

# # import sys
# # a = ["张三", '李四', "王五", "wangcai", "6666"]
# # for i in a:
# #     print(i)

# """
# if
# else
# elif
# for
# def
# class
# while

# 这些关键字后面 冒号
# """
# from draft.who import add
# import os
# # import sys


# # print('aaaa%sbb%sb' % (5000, "aaa"))
# # print("aaaa" + str(5000) + "bb" + "aaa"+"b")
# # data = {
# #     "age": 50,
# #     "name": "aaa"
# # }
# # print('aaaa{age}bb{name}b'.format(**data))


# # # # print("gdsgdhfAFDSDD".encode("utf-8").decode("utf-8").count("g"))

# # # zidian = {
# # #     "name": "张三",
# # #     "age": 5
# # # }

# # # # print(zidian["age"])
# # # nums = [2, 7, 11, 15]


# # # zidian.items()
# # # zidian.keys()
# # # zidian.values()

# # # a, b = [1, 90]

# # # print(a)
# # # print(b)

# # # r:  read
# # # b:  byte   str
# # # w:  write
# # # a:  append
# # # +

# # # print("asdgasdgs".encode("utf-8"))
# # # # 增删改查, 同一时间只有一个人能 增删改，  可以多个人查
# # # # line = ""
# # # # f = open('test.log', "w", encoding="utf-8")
# # # # f.write("111111")
# # # # f.close()
# # # f1 = open('test.log', "wb+")
# # # f1.write("这是追加的内容".encode())
# # # f1.close()

# # # os.remove("test.log")


# # # def test():
# # #     # todo
# # #     pass

# #  and or not
# # > 5 < 10
# a = [1, 5, 7, 9, 10, 145]

# for i in a:
#     if i > 5 and i < 10:
#         print(i)

# # # for key, value in zidian.items():
# # #     # print(key, value)
# # #     pass
# # #     # for k,v in zidian.items():
# # #     #     print("{}={}".format(k, v))

# # #     # print(zidian.items())

# # #     # 字典   {}  另外的叫法 (js  object)   map

# # #     # 我有2份同学名单， 找到张三的同学的名单信息


# tongxue = [
#     {
#         "name": "张三",
#         "age": 19,
#         "身高": 1.75,
#         "isnan": True,
#         "爱好": ["打篮球", "看书", "玩游戏", "飞机"]
#     },
#     {
#         "name": "卓琪",
#         "age": 19,
#         "身高": 1.63,
#         "isnan": False,
#         "爱好": ["逛街", "看书", "玩游戏", "飞机"]
#     }
# ]


# # 1
# # []
# # True, False

# # for k,v in tongxue:
# #     print(k)
# #     print(v)

# b = {
#     "身份证": "xxxxxxxxxxxxxxxxxxxxxxxxxx",
#     "name": "卓琪",
#     "age": 19,
#     "身高": 1.63,
#     "isnan": False,
#     "爱好": ["逛街", "看书", "玩游戏", "飞机"]
# }


# res = json.dumps(b)
# print(res)

# # # print(b["爱好"])


# # # def f(xingming):
# # #     # todo
# # #     # 查找去核对名字是张三的同学
# # #     for stu in tongxue:
# # #         # 如果 name 是 xingming  就直接返回
# # #         if stu["name"] == xingming:
# # #             return stu


# # # print(f("张三"))
# # # print(f("卓琪"))

# # # # f("张三")
# # # #     {
# # # #         "name": "张三",
# # # #         "age": 19,
# # # #         "身高": 1.75,
# # # #         "isnan": True,
# # # #         "爱好": ["打篮球", "看书", "玩游戏", "飞机"]
# # # #     }

# # # # f("卓琪") = {
# # # #     {
# # # #         "身份证": "xxxxxxxxxxxxxxxxxxxxxxxxxx",
# # # #         "name": "卓琪",
# # # #         "age": 19,
# # # #         "身高": 1.63,
# # # #         "isnan": False,
# # # #         "爱好": ["逛街", "看书", "玩游戏", "飞机"]
# # # #     }
# # # # }

# # # # print(tongxue[1])
# # # # print(tongxue[0]["身高"])

# # # # 比较符：   >   < == >=  <=   结果:  bool


# # # # print("1" == "1")
# # # b = 1 == 12
# # # print(not b)
# # # # 没有酱油，  有生抽和醋
# # # # 给你5块钱去买酱油(3)，  如果没有酱油就买生抽(3.5),  如果没生抽就买醋，2 你还剩下多少钱
# # # """
# # # 如果
# # # if (条件):
# # #     如果是真的

# # # else:
# # #     如果是假的
# # # """


# # # # print(shenyu)

# # # # 8号上午
# # # # print("我在1号位置扭螺丝")
# # # # print("我在2号位置扭螺丝")
# # # # print("我在3号位置扭螺丝")
# # # # print("我在4号位置扭螺丝")
# # # # print("我在5号位置扭螺丝")
# # # # print("我在6号位置扭螺丝")
# # # # print("我在7号位置扭螺丝")
# # # # print("我在8号位置扭螺丝")
# # # # print("我在9号位置扭螺丝")
# # # # print("我在10号位置扭螺丝")
# # # # print("我在11号位置扭螺丝")
# # # # print("我在12号位置扭螺丝")

# # # # print("我在1-12号位置扭螺丝")


# # # for i in range(1, 13):
# # #     print("我在%d号位置扭螺丝" % i)


# # # # f(x) = x * x + 3   带入 x = 1,  f(1) = 4
# # # def f(x: int):
# # #     x * x + 3


# # # def f(shangdianshifouyoujiangyou, shangdianshifouyoushengchou):
# # #     wodeqian = 5
# # #     shenyu = 0

# # #     jiangyou = "酱油"
# # #     shengchou = "生抽"
# # #     cu = "醋"

# # #     if shangdianshifouyoujiangyou:
# # #         # 我买了酱油
# # #         shenyu = wodeqian - 3
# # #         print(jiangyou)
# # #     elif shangdianshifouyoushengchou:
# # #         # 我买了生抽
# # #         shenyu = wodeqian - 3.5
# # #         print(shengchou)
# # #     else:
# # #         # 我买了醋
# # #         shenyu = wodeqian - 2
# # #         print(cu)
# # #     return shenyu


# # # print(f(True, True))

# # """
# # 关键字:
# # if
# # else
# # elif
# # for
# # def
# # class
# # while
# # return:  函数
# # continue： for
# # break： 退出for循环
# # """

# # # for i in range(1, 13):
# # #     if i == 10:
# # #         continue
# # #     print(i)

# # """
# # 基础数据类型：
# # int
# # string
# # list
# # dict
# # """
# # # sys.dont_write_bytecode = True
# # # a = 6

# # "aaaa".index("a")
# # "aaaa".center()


# # def index(str, sub) -> int:
# #     return str.index(sub)


# # def center(str, sub) -> int:
# #     return str.index(sub)


# # def index(str, sub) -> int:
# #     return str.index(sub)


# # print(index("aaa", "a"))


# # class Find():
# #     def close(self):
# #         self.index()

# #     def center(self, sub) -> str:
# #         return str.center(sub)

# #     def index(self, sub) -> int:
# #         return self.str.index(sub)

# #     def __init__(self, str) -> None:
# #         self.str = str


# # f = Find("aaa")
# # print(f.index("a"))
# # f.center()


# # class Student():

# #     hobby = ["打篮球"]

# #     def __init__(self, name: str, age: int, height: float, isnan: bool, hobby: list) -> None:
# #         self.name = name
# #         self.age = age
# #         self.height = height
# #         self.isnan = isnan
# #         self.hobby = hobby
# #         self.newhobby = self.__class__.hobby

# #     def run(self, name="zhangsan"):
# #         return name


# # zhangsan = Student("张三", 19, 1.75, True, ["打篮球", "看书", "玩游戏", "飞机"])
# # zhangsan.run()
# # print(zhangsan.hobby)


# # # a = [3, 5, 6, 7, 2, 8, 9, 10]
# # # 第一次：   [3, 5, 6, 7,  8, 9]
# # # [2]
# # # b = []
# # # b.append()

# # # 第二次： [3, 5, 6, 7, 8, 9]

# # # [2, 3]
# # # ...


# # # 数组索引
# # # %d: 整数
# # # %s： 字符串


# # # 这是昨天的，
# # # b = []
# # # for i in range(7):
# # #     min = a[0]
# # #     for v in a:
# # #         if min > v:
# # #             min = v
# # #     b.append(min)
# # #     a.remove(min)

# # # print(b)

# # # 优化后的
# # # for i in range(len(a)):
# # #     min = a[i]
# # #     # 遍历出来的每一个值
# # #     for j in range(i+1, len(a)):
# # #         if min > a[j]:
# # #             a[i] = a[j]
# # #             a[j] = min
# # #             min = a[i]

# # # print(a)

# # # a = 1
# # # b = 3
# # # a, b = b, a
# # # print("a:", a)
# # # print("b: ", b)

# # # a = [5, 7, 1, 3, 2, 9, 4]
# # # # 明天再优化, 冒泡排序
# # # l = len(a)
# # # for i in range(l):
# # #     # 遍历出来的每一个值
# # #     for j in range(i+1, l):
# # #         if a[i] > a[j]:
# # #             a[i], a[j] = a[j], a[i]


# # # print(a)
# # # count = 0
# # # for i in range(1, 80000):
# # #     count = count + i

# # # print(count)
# # # # + - * /  %

# # # b = (1+(80000-1)) * (80000-1) // 2
# # # print(b)


# # # ((((((((0) + 1) + 2) + 3) + 4) + 5) + 6) + 7) = 28

# # # for i in range(len(a)):
# # #     # 遍历出来的每一个值
# # #     for j in range(i+1, len(a)):
# # #         if a[i] > a[j]:
# # #             a[i], a[j] = a[j], a[i]

# # # print(a)


# # # # 第一轮
# # # [5, 7, 1, 3, 2, 9, 4]
# # # [1, 7, 5, 3, 2, 9, 4]
# # # # 第二轮
# # # [1, 5, 7, 3, 2, 9, 4]
# # # [1, 3, 7, 5, 2, 9, 4]
# # # [1, 2, 7, 5, 3, 9, 4]
# # # # 第三轮
# # # [1, 2, 3, 7, 6, 8, 9]
# # # # 第四轮
# # # [1, 2, 3, 6, 7, 8, 9]
# # # ...

# # # 只要是存储的东西都有罪基本的四个操作
# # # 增删改查

# # a = ["张三", '李四', "王五", "wangcai", "6666"]

# # a.append("777")
# # # a.remove("wangcai")
# # a[0] = "王二狗"
# # # a.sort()
# # a.insert(1, "1111")
# # a.insert(1, "1111")
# # a.insert(1, "1111")
# # # result = a.pop(4)
# # result = a.count("1111")
# # i = a.index("wangcai")
# # a.clear()
# # # print(i)
# # # print(a[i])
# # # []
# # # print(a)
# # print("hello world")
# # # 10101010101
# # print(add(1, 4))

# # class Plane():
# #     def __init__(self):
# #         self.cap = 120

# #     def fly(self):
# #         print("我能飞")


# # p = Plane()
# # p.fly()

# # break:   直接跳出最近的for循环
# # continue: 见到语句的时候， 跳过此次最近的for循环 进入下一个循环
# # for j in range(3):
# #     # j = 0
# #     for i in range(3):
# #         if i == 1:
# #             continue
# #         print(i)
# #     print(j)

# # for i in range(1, 9999999):
# #     #
# #     print(i)


# # return: 跳出最近的函数

# {}
# []
# ""


# def print_num(start: int, end: int = 10) -> None:
#     if start > 1:
#         return
#     for i in range(start, end):
#         print(i)


# print_num(1, 20)
# # print(1)
# # print(2)
# # print(3)
# # print(4)
# # print(5)
# # print(6)
# # print(7)


# # 1 == 1: True


# # 1 > n: False


# # n > 1


# # 随机给一个数， 1 2 4 8 16
# # 2:     2 / 2 == 1 - -> True
# # 4:     4 / 2 == 2 但是大于   2 / 2 == 1 // /

# # for (int i = 0; i < 10; i++) {
# #     System.out.println(i);
# # }
# # for i in range(1, 10):
# # 0 1 2 3 4 5 6  7  8
# # 0 1 1 2 3 5 8 13 21

# # x0 = 0
# # x1 = 1
# # x2 = x1 + x0 = 1
# # x3 = x2 + x1 = x1 + x0 + x1 = 2
# # x4 = x3 + x2 = x2 + x1 + x1 + x0 = x1 + x0 + x1 + x1 + x0 = 3
# #


# # def fbnq(a: int) -> int:
# #     # 返回 a: 斐波那契列表位置对应的值
# #     if a == 0:
# #         return 0
# #     if a == 1:
# #         return 1
# #     return fbnq(a-1) + fbnq(a-2)
# # # 递归
# # # 二个要素： 第一个找准退出条件，  第二个是 返回计算后的值


# # def check(a: int) -> bool:
# #     a = a/2
# #     if a == 1:
# #         return True
# #     if a < 1:
# #         return False
# #     # > 1 到这里来了
# #     return check(a)


# # x = check
# # print(check(8))
# # print(x(8))

# # print(check(19))

# # print(check(8))
# # print(check(9))
# # print(check(10))
# # print(check(11))
# # print(check(12))
# # print(check(13))
# # print(check(14))
# # print(check(15))
# # print(check(16))

# def A():
#     for i in range(10):
#         print(i)
#         return


# # A()


# def list_file(dir: str) -> None:
#     for i in os.listdir(dir):
#         p = os.path.join(dir, i)
#         if os.path.isfile(p):
#             print(p)
#         else:
#             # 这是目录
#             if i == ".git":
#                 continue
#             list_file(p)


# list_file(".\\\"answer")

# # int
# # str
# # list
# # dict


# # 可变参数
# # *args:  []
# # **kargs: {}

# def a(*args):
#     print(args)
#     for i in args:
#         print(i)
#     print("1111")


# a(1, 2, 4, 1)


# def a(**kargs):
#     for i in kargs:
#         print(i)
#     print("1111")

# a(1,2,4)
# # class


# # a(kk={"aa": "1", "bb": "2", "cc": "3"})

# # a(aa="1", bb="2", cc="3")

# def add(a: int, b: int) -> tuple:
#     return a+b, a*b


# a = [10, 20]
# x, y = a
# # x, y = add(5, 6)
# print(x)
# print(y)


# # c(c++)  c# go  javascript  python 他们的库多
# #  mysql
# # shell脚本语言  linux 必备技能


# with open("test.log", "r", encoding="utf-8") as f:
#     print(f.read())


# f = open("test.log", "r", encoding="utf-8")
# print(f.read())
# f.close()
